package com.kitty.game.party.model;

import com.kitty.game.friend.model.RoleView;
import com.kitty.game.role.model.Role;
import com.kitty.common.utils.SpringUtils;
import com.kitty.game.utils.TimeUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class PartyMemberObject {
    private long roleUid;
    private String gid;
    private String roleName;
    private short portrait=0;
    private String job;//帮派职位
    private short level;
    private String family;//门派名字
    private int contrib=0;
    private int vitality;//活力
    private short polor;//相性 门怕派
    private short gender=0;//性别
    private int lastWeekVitality;//上周活力
    private int currWeekVitality;//本周活力
    private int joinTime;
    private int tao =100;//道行
    private short totalCurWarTimes=0;//帮战总次数
    private int lastOnlineTime;
    private int curWarTimes=0;//本届帮战次数
    private boolean titleChange; //称号是否变化
    private List<RedBagRecord> sendRedBagRecords;
    private List<RedBagRecord> recvRedBagRecords;


    public PartyMemberObject() {}

    public PartyMemberObject(long roleUid, String roleName, int joinTime) {
        this.roleUid = roleUid;
        this.gid = String.valueOf(roleUid);
        this.roleName = roleName;
        this.joinTime = joinTime;
    }

    public PartyMemberObject(Role role, long joinTime, String partyJob) {
        this.roleUid = role.getUid();
        this.roleName = role.getName();
        this.job = partyJob;
        this.joinTime = (int) (joinTime / TimeUtil.ONE_SECOND);
        this.lastOnlineTime = (int) (joinTime / TimeUtil.ONE_SECOND);
        this.level = role.getLevel();
        this.tao = role.getTao();
        this.gid = role.getGid();
        this.level = role.getLevel();
        this.family = SpringUtils.getRoleService().getFamilyName(role.getPolar());
        this.polor = role.getPolar();
        this.portrait = role.getRoleIcon();
        this.gender = role.getGender();
    }

    public PartyMemberObject(RoleView roleView, long joinTime, String partyJob) {
        this.roleUid = Long.parseLong(roleView.getGid());
        this.roleName = roleView.getName();
        this.job = partyJob;
        this.joinTime = (int) (joinTime / TimeUtil.ONE_SECOND);
        this.lastOnlineTime = (int) (joinTime / TimeUtil.ONE_SECOND);
        this.level = roleView.getLevel();
        this.tao = roleView.getTao();
        this.gid = roleView.getGid();
        this.level = roleView.getLevel();
        this.family = SpringUtils.getRoleService().getFamilyName(roleView.getPolar());
        this.polor = roleView.getPolar();
        this.portrait = roleView.getRoleIcon();
        this.gender = roleView.getGender();
    }
}
